/*
 * Copyright (c) 2025 Li Auto Inc. and its affiliates
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * This file was generated form {{ Idlfilename }}.idl by the mvbs-idl-gen tool.
 */

{% import './general/typeRPC.jinja2' as RPC -%}
#ifndef __{{ Idlfilename | upper }}RPCCLIENT_H
#define __{{ Idlfilename | upper }}RPCCLIENT_H
#include <rpc/rpc.h>
#include "{{ Idlfilename }}RpcParams.h"

{% for node in constructMapList -%}
{% for member in node.FuncMember -%}

{%- if node.ModuleName -%}
	{% set interface_name = node.ModuleName ~ "_" ~ node.InterfaceName %}
{%- else -%}
	{% set interface_name = node.InterfaceName %}
{%- endif -%}

{%- set inputs = member.ParamIn | default([]) + member.ParamInout | default([]) -%}
{%- set outputs = member.ParamOut | default([]) + member.ParamInout | default([]) -%}

{%- if "_stream" in member.FuncName and member.FuncName.split("_")[-1] == "stream" %}
int32_t {{ interface_name }}_{{ member.FuncName }}(struct rpc_client *cli, {{ RPC.FunctionInputsParam(interface_name, member, inputs)}}
							int32_t (*{{ member.FuncName }}_cb)({{ RPC.FunctionOutputsParam(interface_name, member, outputs)}}int32_t rpc_errno),
							uint32_t *sn, uint32_t timeout);{{"\n"}}
{%- else %}
int32_t {{ interface_name }}_{{ member.FuncName }}(struct rpc_client *cli, {{ RPC.FunctionInputsParam(interface_name, member, inputs)}}
							int32_t (*{{ member.FuncName }}_cb)({{ RPC.FunctionOutputsParam(interface_name, member, outputs)}}int32_t rpc_errno),
							uint32_t timeout);{{"\n"}}
{%- endif %}

{%- endfor %}
{%- endfor %}

#endif /* !__{{ Idlfilename | upper }}RPCCLIENT_H__ */
